package main

import "fmt"

// 结构体,用type关键字来声明一个结构体
type person struct {
	name string
	age  int
}

func createPerson(name string, age int) *person {
	p := person{
		name: name,
		age:  age,
	}
	return &p
}

func main() {
	fmt.Println(person{
		name: "lixinjia",
		age:  27,
	})

	fmt.Println(&person{
		name: "",
		age:  0,
	})

	fmt.Println(createPerson("lxj", 27))

	p := person{
		name: "lixinjia",
		age:  28,
	}

	sp := &p
	fmt.Println(sp.age, sp.name)
	sp.age = 27
	fmt.Println(sp.age, sp.name)

}
